package org.example.state;

import org.example.model.FarmMachine;

public class FaultState implements MachineState {
    @Override
    public String getStateName() {
        return "故障状态";
    }

    @Override
    public void handleEvent(FarmMachine machine, String event) {
        if ("故障已修复".equals(event)) {
            machine.setState(new IdleState());
            System.out.println(machine.getType() + "[" + machine.getId() + "] 从故障状态切换到闲置状态");
        }
    }

    @Override
    public void execute(FarmMachine machine) {
        System.out.println(machine.getType() + "[" + machine.getId() + "] 处于故障状态，等待维修");
    }
}